<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>微博</title>
<link href="style/weibo.css" rel="stylesheet" type="text/css" />
	<script src="js/ajax.js"></script>
</head>

<body>
<div class="jyArea">
     <div class="takeComment">
        <textarea name="textarea" class="takeTextField" id="tijiaoText"></textarea>
        <div class="takeSbmComment">
            <input type="button" class="inputs" value="" />
        </div>
    </div>


    <div class="commentOn">
        <div class="noContent">暂无留言</div>
        <div class="messList">
        	<div class="reply">
                <p class="replyContent">内容</p>
                <p class="operation">
                    <span class="replyTime">2020.03.10 01:01:01</span>
                    <span class="handle">
                    	<a href="javascript:;" class="top">0</a>
                        <a href="javascript:;" class="down_icon">9</a>
                        <a href="javascript:;" class="cut">删除</a>
                    </span>
                </p>
            </div>
        </div>
        <div class="page">
        	<a href="javascript:;" class="active">1</a>
        	<a href="javascript:;">2</a>
        	<a href="javascript:;">3</a>
        </div>
    </div>
</div>
</body>
<script>
	const contextArea = document.querySelector("#tijiaoText");
	document.querySelector(".inputs").onclick = function(){
		ajax.post("/addWeibo",{
			context:contextArea.value.trim()
		},{
			success({ok,msg}){
				if(ok === 1){
					contextArea.value = null;
					console.log(ok,msg);
					getWeibo();
				}else{
					alert(msg);
				}
			}
		})
	}//
	getWeibo();
	function getWeibo(){
		ajax.get("/getWeibo",{
			success(res){
				console.log(res);
			}
		})
	}
	// promise
</script>
</html>
